/*
 * @Author: your name
 * @Date: 2021-03-15 23:07:25
 * @LastEditTime: 2021-11-23 11:29:15
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \cpp11\cpp11_test.cpp
 */
#if __cplusplus >= 201103L
#pragma  message("编译器支持c++11")
#endif 
#include <list>
#include<iostream>
#include <algorithm>
using namespace std;
// #include "thread_usage.h"
#include "threadpool.h"
// #include "json.h"
#include "template.h"
extern "C"{
#include<stdio.h>
#include <time.h>
}
#include <windows.h>
#include <Tlhelp32.h>
#include "loger.h"
#include <psapi.h>
#include "function/daemon.h"
#include "threadsafe/thread_safe_list.hpp"


std::string FormatString(const char *format,...)
{
    va_list args;
    char buf[1024];
    va_start(args,format);
    vsprintf(buf,format,args);
    va_end(args);
    return std::string(buf);
}


int main(int argc, char **argv)
{
    auto tmp = FormatString("hello world %d %c %d",100,'c',true);
    std::cout<<tmp<<std::endl;
    int i = 0;
    ThreadSafeList<int> ip;
    ip.PushFront(102);
    ip.PushFront(111);


    ThreadSafeList<int> *p = &ip;
    std::thread t1([p]{
        Sleep(4000);
        ((ThreadSafeList<int>*)p)->PushFront(123);
        
    });
    auto x = ip.Front();
    std::cout<<*x<<"\r\n";
    
    std::cout<<ip.PopFrontAndWait()<<"\r\n";
    std::cout<<ip.PopFrontAndWait()<<"\r\n";

    t1.join();
}
